#!/bin/bash
set -eo pipefail
cd /opt/export/

runday="{{ execution_date | date_add(1) | cst_ds }}"

#hdfs dfs -get -f /report/出港时效_中转/出港时效_中转_$runday   /opt/export/出港时效_中转_$runday
hdfs dfs -get -f /report/出港时效_始发/出港时效_始发_$runday   /opt/export/出港时效_始发_$runday



zip /opt/export/出港时效_始发_$runday.zip  /opt/export/出港时效_始发_$runday/*

#zip /opt/export/出港时效_中转_$runday.zip  /opt/export/出港时效_中转_$runday/*

/usr/local/python3/bin/python3  /usr/local/airflow/dags/utils/operators/upload_oss.py  出港时效_始发/出港时效_始发_$runday.zip  /opt/export/出港时效_始发_$runday.zip
#/usr/local/python3/bin/python3  /usr/local/airflow/dags/utils/operators/upload_oss.py  出港时效_中转/出港时效_中转_$runday.zip  /opt/export/出港时效_中转_$runday.zip

data_size=$(ls -lh 出港时效_始发_$runday.zip | awk '{print $5}')
#data_size1=$(ls -lh 出港时效_中转_$runday.zip | awk '{print $5}')
Message="出港时效_始发new_$runday 报表上传成功 大小: $data_size"
#Message1="出港时效_中转new_$runday 报表上传成功 大小: $data_size1"

curl 'https://oapi.dingtalk.com/robot/send?access_token=816a8f35fd84432ffa6bff9d7714abc322628bb4a8ded86908550d2335aba613' \
   -H 'Content-Type: application/json' \
   -d "
  {\"msgtype\": \"text\",
    \"text\": {
        \"content\": \"监控内容:$Message\"
     }
  }" || true

#  curl 'https://oapi.dingtalk.com/robot/send?access_token=816a8f35fd84432ffa6bff9d7714abc322628bb4a8ded86908550d2335aba613' \
#   -H 'Content-Type: application/json' \
#   -d "
#  {\"msgtype\": \"text\",
#    \"text\": {
#        \"content\": \"监控内容:$Message1\"
#     }
#  }" || true

#rm -rf /opt/export/出港时效_中转_$runday
rm -rf /opt/export/出港时效_始发_$runday
rm -rf /opt/export/出港时效_始发_$runday.zip
#rm -rf /opt/export/出港时效_中转_$runday.zip